/*
 * KeyDetectMod.c
 *
 *  Created on: 2012-02-16
 *      Author: mxw
 */
#include <KeyDetectMod.h>
#include <MainModu.h>

#define KD_MOD_BUFF_LEN  2048

CModule gKeyDetectMod;
static char _kd_mod_buf[KD_MOD_BUFF_LEN] = {0};


static int on_kd_mod_recv_msg(struct _cmodule_* thes, CMsg* msg) {
    CMsg msg_main;
    msg_main.msg_id = CMD_KEY_DOWN;
    msg_main.data_len = 1;
    msg_main.data[0] = msg->data[0];
    gMainMod.sendMsg(&gMainMod, &msg_main);
    return 0;
}

int init_key_detect_module() {
    construct_module(&gKeyDetectMod, "key detect module", on_kd_mod_recv_msg);
    gKeyDetectMod.q.set_queue_buf(&gKeyDetectMod.q, _kd_mod_buf, KD_MOD_BUFF_LEN);
    gKeyDetectMod.run(&gKeyDetectMod);
    return 0;
}

